package com.husawang.husa.lib.base.net;

import java.util.Map;

import okhttp3.FormBody;
import okhttp3.Request;

/**
 * Created by s on 2017/8/8.
 */

public class HusaRequest {

	private static HusaRequest mHusaRequest;

	private HusaRequest() {
	}

	public static HusaRequest getInstance() {
		if (mHusaRequest==null){
			return new HusaRequest();
		}
		return mHusaRequest;
	}

	public Request getRequest4Param(String url, Map<String, String> mapParams){
		FormBody.Builder builder = HusaFormBody.getInstance().getFormBodyBuilder();
		if (null!=mapParams){
			for (String key : mapParams.keySet()) {
				builder.add(key, mapParams.get(key));
			}
		}

		Request request = new Request.Builder()
				.url(url)
				.post(builder.build())
				.build();
		return request;
	}


}
